import {
	onLoad,
	onReady,
	onPageScroll,
	onShow,
	onReachBottom
} from "@dcloudio/uni-app"


// 获取系统信息
const systemInfo = uni.getSystemInfoSync();



export const getStatusBarHeight = () => systemInfo.statusBarHeight || 15;
//  获取胶囊按钮样式的API
let menuButtonInfo = null;
// #ifdef MP-WEIXIN
menuButtonInfo = uni.getMenuButtonBoundingClientRect()
// #endif

export const getTitleBraHeight = () => {

	if (menuButtonInfo != null) {
		let top = menuButtonInfo.top;
		let height = menuButtonInfo.height;
		return (top - getStatusBarHeight()) * 2 + height;
	} else {
		return 40;
	}
}

export const getNavbarHeight = () => getStatusBarHeight() + getTitleBraHeight();


// 抖音小程序的左边胶囊
// #ifdef MP-TOUTIAO
export const getLeftIcon = () => {
	if (tt.getCustomButtonBoundingClientRect) {
		let {
			leftIcon: {
				left,
				width
			}
		} = tt.getCustomButtonBoundingClientRect()
	}
	elsef {
		return 0;
	}
}
// #endif